import useUserStore from '@/store/user';
import type { App } from 'vue';

export const admin = (app: App) => {
  app.directive('admin', {
    beforeMount(el: HTMLElement) {
      const userStore = useUserStore();
      const userInfo = userStore.$state.userInfo;
      if (!userInfo || !userInfo.admin) {
        el.style.display = 'none';
      }
    },
  });
};
